/**
 * @file foreignObjectElement.js
 * @author lili39@didichuxing.com
 * @date 2018-08-31 14:50:47
 */

export default {
    name: 'foreignObjectElement',
    inject: ['$$tree'],
    props: {
        nodeData: Object,
        renderForeignObjects: Function
    },
    created() {
        if (this.$$tree.$scopedSlots) {
            const $node = this.$options.parent;
            const nodeData = $node.$options.propsData.nodeData;
            this.$options.render = h =>
                h('div', { class: 'foregin-object' }, [
                    this.$$tree.$scopedSlots.default(nodeData)
                ]);
        }
    }
};
